﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BusinessObjects.BO_GetObjects;

public partial class Controls_ucVote : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            rptVoteLoad();
    }
    private void rptVoteLoad()
    {
        try
        {
            DataSet ds = new DataSet();
            ds.ReadXml(Server.MapPath("~/upload/xml/vote.xml"));

            DataTable objDT = ds.Tables[0];
            if (objDT.Rows.Count > 0)
            {
                //string VOTE_ANSWERS = objDT.Rows[0]["VOTE_ANSWERS"].ToString();
                divQuesion.InnerText = objDT.Rows[0]["QUESTION"].ToString();
                //string[] listVote = VOTE_ANSWERS.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                //rblVote.Items.Clear();
                //foreach (string perVote in listVote)
                //{
                //    string[] allInfo = perVote.Split(new string[] { ":*:" }, StringSplitOptions.RemoveEmptyEntries);
                //    rblVote.Items.Add(new ListItem(allInfo[1], allInfo[1]));
                //}
            }
            objDT = ds.Tables[1];
            if (objDT.Rows.Count > 0)
            {
                foreach (DataRow row in objDT.Rows)
                {
                    rblVote.Items.Add(new ListItem(row["ANSWER"].ToString(), row["ANSWER"].ToString()));
                }
            }
        }
        catch { }
    }
}